package com.gaojiawei.multiThread14_ConcurrentHashMap;

import java.util.concurrent.ConcurrentHashMap;

public class L04_ConcurrentHashMapComputeIfAbsentMethod {
    public static void main(String[] args) {
        ConcurrentHashMap<String, Integer> stringIntegerConcurrentHashMap = new ConcurrentHashMap<>();
        stringIntegerConcurrentHashMap.put("key",1);
        stringIntegerConcurrentHashMap.computeIfAbsent("key2",(key)->{
            return 2;
        });
        stringIntegerConcurrentHashMap.computeIfAbsent("key2",(key)->{
            return 3;
        });
        System.out.println(stringIntegerConcurrentHashMap);
    }
}
